//$URL: http://dasding.googlecode.com/svn/branches/testzeugs/data/dao/couchDB/src/main/java/de/piratech/dasding/data/database/couch/ActionDataImpl.java $
//$Id: ActionDataImpl.java 98 2013-03-26 19:40:11Z amuthmann@googlemail.com $
/*
 * Copyright 2012 Piratech.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.piratech.dasding.data.database.couch;

import de.piratech.dasding.data.Action;
import de.piratech.dasding.data.database.ActionData;
import de.piratech.dasding.data.database.DatabaseException;

import java.util.ArrayList;
import java.util.List;

import org.ektorp.CouchDbConnector;
import org.ektorp.support.CouchDbRepositorySupport;

/**
 */
public class ActionDataImpl extends CouchDbRepositorySupport<Action>
        implements ActionData {

  protected ActionDataImpl(CouchDbConnector pDB) {
    super(Action.class, pDB, "Action");
    initStandardDesignDocument();
  }

  @Override
  public Action createAction(Action pAction) {
    db.create(pAction);
    return pAction;
  }

  @Override
  public void deleteAction(Action pAction) {
    remove(pAction);
  }

  @Override
  public void updateAction(Action pAction) {
    update(pAction);
  }

  @Override
  public Action getAction(String pId) {
    return get(pId);
  }

  @Override
  public List<Action> getActions() {
    return new ArrayList<Action>(getAll());
  }

  @Override
  public List<Action> findActionsByCategories(List<String> pCategory)
          throws DatabaseException {
    List<Action> actions = new ArrayList<Action>();
    return actions;

  }
}
